/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package POJOS;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author jim
 */
@Entity
@Table(name = "MUSIC_PRODUCTION_COMPANY")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "MusicProductionCompany.findAll", query = "SELECT m FROM MusicProductionCompany m"),
    @NamedQuery(name = "MusicProductionCompany.findByIdMusicProductionCompany", query = "SELECT m FROM MusicProductionCompany m WHERE m.idMusicProductionCompany = :idMusicProductionCompany"),
    @NamedQuery(name = "MusicProductionCompany.findByNameMpc", query = "SELECT m FROM MusicProductionCompany m WHERE m.nameMpc = :nameMpc"),
    @NamedQuery(name = "MusicProductionCompany.findByAddress", query = "SELECT m FROM MusicProductionCompany m WHERE m.address = :address"),
    @NamedQuery(name = "MusicProductionCompany.findByTelephone", query = "SELECT m FROM MusicProductionCompany m WHERE m.telephone = :telephone")})
public class MusicProductionCompany implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID_MUSIC_PRODUCTION_COMPANY")
    private Integer idMusicProductionCompany;
    @Basic(optional = false)
    @Column(name = "NAME_MPC")
    private String nameMpc;
    @Basic(optional = false)
    @Column(name = "ADDRESS")
    private String address;
    @Basic(optional = false)
    @Column(name = "TELEPHONE")
    private String telephone;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idMusicProductionCompany")
    private Collection<Album> albumCollection;

    public MusicProductionCompany() {
    }

    public MusicProductionCompany(Integer idMusicProductionCompany) {
        this.idMusicProductionCompany = idMusicProductionCompany;
    }

    public MusicProductionCompany(Integer idMusicProductionCompany, String nameMpc, String address, String telephone) {
        this.idMusicProductionCompany = idMusicProductionCompany;
        this.nameMpc = nameMpc;
        this.address = address;
        this.telephone = telephone;
    }

    public Integer getIdMusicProductionCompany() {
        return idMusicProductionCompany;
    }

    public void setIdMusicProductionCompany(Integer idMusicProductionCompany) {
        Integer oldIdMusicProductionCompany = this.idMusicProductionCompany;
        this.idMusicProductionCompany = idMusicProductionCompany;
        changeSupport.firePropertyChange("idMusicProductionCompany", oldIdMusicProductionCompany, idMusicProductionCompany);
    }

    public String getNameMpc() {
        return nameMpc;
    }

    public void setNameMpc(String nameMpc) {
        String oldNameMpc = this.nameMpc;
        this.nameMpc = nameMpc;
        changeSupport.firePropertyChange("nameMpc", oldNameMpc, nameMpc);
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        String oldAddress = this.address;
        this.address = address;
        changeSupport.firePropertyChange("address", oldAddress, address);
    }

    public String getTelephone() {
        return telephone;
    }

    public void setTelephone(String telephone) {
        String oldTelephone = this.telephone;
        this.telephone = telephone;
        changeSupport.firePropertyChange("telephone", oldTelephone, telephone);
    }

    @XmlTransient
    public Collection<Album> getAlbumCollection() {
        return albumCollection;
    }

    public void setAlbumCollection(Collection<Album> albumCollection) {
        this.albumCollection = albumCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idMusicProductionCompany != null ? idMusicProductionCompany.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof MusicProductionCompany)) {
            return false;
        }
        MusicProductionCompany other = (MusicProductionCompany) object;
        if ((this.idMusicProductionCompany == null && other.idMusicProductionCompany != null) || (this.idMusicProductionCompany != null && !this.idMusicProductionCompany.equals(other.idMusicProductionCompany))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "POJOS.MusicProductionCompany[ idMusicProductionCompany=" + idMusicProductionCompany + " ]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }
    
}
